package rssApp.builders 
{
	import com.bit101.components.Component;
	import com.bit101.components.Label;
	import com.bit101.components.Panel;
	import com.bit101.components.Style;
	import com.bit101.components.Text;
	import com.bit101.components.VBox;
	import common.IComponentBuilder;
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.text.AntiAliasType;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import rss.IRssEntryModel;
	import rssApp.components.RssAppItemComponent;
	/**
	 * This class constructs and populates instances of RssAppItemCompent from
	 * a feed entry model.
	 * 
	 * @author Luke Van In
	 */
	public class RssAppItemComponentBuilder implements IComponentBuilder
	{
		
		// private variables
		private var _eventDispatcher:IEventDispatcher;
		
		private var _container:Component;
		
		private var _model:IRssEntryModel;
		
		
		
		/**
		 * 
		 * @param	displayObjectContainer
		 */
		public function RssAppItemComponentBuilder(eventDispatcher:IEventDispatcher, container:Component, model:IRssEntryModel) 
		{
			this._eventDispatcher = eventDispatcher;
			
			this._container = container;
			
			this._model = model;
		}
		
		
		
		/* INTERFACE rssApp.IRssAppItemComponentBuilder */
		
		/**
		 * Creates and returns an instance of RssAppItemCompnent
		 * 
		 * @return
		 */
		public function buildComponent():Component 
		{			
			var component:RssAppItemComponent = new RssAppItemComponent(this._eventDispatcher, this._container, 0, 0);
			
			component.title = this._model.title;
			
			component.description = this._model.description;
			
			component.date = "Published date: " + this._model.publishedDate.toDateString();
			
			component.category = "Category: " + this._model.category;
			
			component.link = this._model.link;
			
			return component;
		}
		
		
		/**
		 * 
		 */
		public function dispose():void 
		{
			
		}
		
	}

}